package com.job.project.exception;

import com.job.project.utils.RestResponse;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author 王博
 * @DateTime 2024-05-24 18:03
 */
@ControllerAdvice
@ResponseBody
public class GlobalExceptionHandler {
    @ExceptionHandler(ServiceException.class)
    public RestResponse serviceException(ServiceException exception){
        return RestResponse.failed(exception.getMessage());
    }
}
